//
//  ACLiveMemberListCell.m
//  ACLiteAVUISDK
//
//  Created by Ben on 2021/4/1.
//

#import "ACLiveMemberListCell.h"

@interface ACLiveMemberListCell ()

@property (unsafe_unretained, nonatomic) IBOutlet UIImageView *headImg;
@property (unsafe_unretained, nonatomic) IBOutlet UILabel *nameLabel;

@end


@implementation ACLiveMemberListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.headImg.layer.masksToBounds = YES;
    self.headImg.layer.cornerRadius = 19;
    
    [self.cancelForbiden setHidden:YES];
    
    self.cancelForbiden.layer.masksToBounds = YES;
    self.cancelForbiden.layer.cornerRadius = 14;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)cancelForbidenBtnClick:(id)sender {
    if (self.clickActionHandler) {
        self.clickActionHandler(1);
    }
}

-(void)setUserInfo:(TRTCLiveUserInfo *)userInfo{
    _userInfo = userInfo;
    if ([_userInfo.userId isEqualToString:[[ACUserProfileManager shareInstance] getUserModel].user_id]) {
        [self.cancelForbiden setHidden:YES];
    }else{
        [self.cancelForbiden setHidden:NO];
    }
    NSString *headIconStr = _userInfo.avatarURL;
    if ((![headIconStr startsWith:@"http://"] && ![headIconStr startsWith:@"https://"]) && headIconStr != nil) {
        headIconStr = [@"http://" stringByAppendingString:headIconStr];
    }
    [self.headImg sd_setImageWithURL:[NSURL URLWithString:headIconStr]];
    self.nameLabel.text = _userInfo.userName;
}


@end
